<!-- 待发货 -->
<template>
	<view class="">
		<view class="flex flex-column align-end">
			<view class="flex align-center u-p-y-10">
				<text class="u-m-r-30 u-p-y-10">共计{{item.goods.length}}件</text>
				<text class="u-font-30 u-m-r-5">合计</text>
				<text class="u-font-30 text-danger"> ¥{{item.pay_price}}</text>
			</view>
		</view>
		<view class="flex justify-end text-center">
			<template v-if="item.is_finish == 0">
				<dy-button width="140rpx" backgroundColor="#fff" color="#333" borderColor="#C2C5C8" v-if="item.is_finish == 0" @click="btnOrder">退款</dy-button>
				<dy-button width="140rpx" backgroundColor="#fff" color="#333" borderColor="#C2C5C8" disabled v-else>售后中</dy-button>
			</template>
			<dy-button class="u-m-l-30" width="140rpx" @click="toOrderDetail">查看详情</dy-button>
		</view>
	</view>

</template>

<script>
	import { OrderCenterApi } from '@/api/serves.js'
	export default {
		name:"order-item-waitfreight",
		props: {
			item: {
				type: Object,
				default() {
					return {}
				}
			},
		},
		mounted() {
			// console.log(111, this.item);
		},
		methods: {
			// 待发货订单退款
			btnOrder(goods_id) {
				uni.showModal({
					title: '提示',
					content: '确定申请退款吗?',
					success: (res)=> {
						if (res.confirm) {
							uni.showLoading()
							OrderCenterApi.after_sale_orders1({ order_no: this.item.order_no}).then((res) => {
								this.$HideLoading()
								console.log('退款', res);
								this.$u.toast(res.msg)
								if(res.code == 1){
									uni.$emit('orderClick')
								}
							});
						}
					}
				});
			},
			toOrderDetail() {
				uni.navigateTo({
					url: '/pages/order/mineOrderDetail/mineOrderDetail?order_no=' + this.item.order_no
				})
			},
		}
		
	}
</script>

<style scoped lang="scss">
</style>
